<style type="text/css">
    <?php if(!$view->settings['is_show_logo']){?>
    .is_show_logo_yes{
        display: none;
    }
    <?php } ?>

    <?php if(!$view->settings['is_show_facebook_share']){?>
    .is_show_facebook_share_yes{
        display: none;
    }
    <?php } ?>

    <?php if(!$view->settings['is_show_facebook_like']){?>
    .is_show_facebook_like_yes{
        display: none;
    }
    <?php } ?>

    .content .box .box-head.tabs ul.nav-tabs.nav-tabs-main {
      float: left;
    }
    .content .box .box-head.tabs ul.nav-tabs.nav-tabs-main li a {
      padding: 7px 12px;
      border-color: #a6a6a6;
    }
    .content .box .box-head.tabs ul.nav-tabs.nav-tabs-main li.active a {
      border-bottom: 1px solid #fff;
    }
    .content .box .box-head.tabs ul.nav-tabs.nav-tabs-main li:first-child a {
      border-left-color: #a6a6a6;
      -webkit-border-radius: 3px 0 0 0;
      -moz-border-radius: 3px 0 0 0;
      border-radius: 3px 0 0 0;
    }
    .content .box .box-head.tabs ul.nav-tabs.nav-tabs-main li:last-child a {
      -webkit-border-radius: 0 3px 0 0;
      -moz-border-radius: 0 3px 0 0;
      border-radius: 0 3px 0 0;
    }
    .content .box .box-head.tabs-main {
      padding: 6px 8px 0 6px;
    }

</style>
<div class="row-fluid">
	<div class="span12">
		<div class="box">
                    <div class="box-head">
                            <h3>General Settings</h3>
                    </div>
                    <div class="box-head tabs-main tabs">
                            <ul class="nav nav-tabs nav-tabs-main">
                                    <li class="active">
                                            <a href="#1" data-toggle="tab">General</a>
                                    </li>
                                    <li class="">
                                            <a href="#2" data-toggle="tab">Logo Settings</a>
                                    </li>
                                    <li class="">
                                            <a href="#3" data-toggle="tab">Like Gate Settings</a>
                                    </li>
                                    <li class="">
                                            <a href="#4" data-toggle="tab">TOS Settings</a>
                                    </li>
                                    <li class="">
                                            <a href="#5" data-toggle="tab">Viral Settings</a>
                                    </li>
                            </ul>
                    </div>
                    <form action="" class="validate form-horizontal" method="post" enctype="multipart/form-data">
                        <fieldset>
                        <div class="box-content">
                                <div class="tab-content">
                                    <div class="tab-pane active" id="1">
                                        <?php if(count($_POST) > 0){?>
                                        <div class="alert alert-info">
                                            Data saved successfully
                                        </div>
                                        <?php } ?>
                                        <?php if($view->error){?>
                                        <div class="alert alert-error"><?php echo $view->error;?></div>
                                        <?php } ?>

                                        <div class="control-group">
                                                <label for="turn_front_end_on_off" class="control-label">Turn front-end on/off</label>
                                                <div class="controls">
                                                    <div class="tip" data-placement="right" data-original-title='If set to "off" the entire front-end application will be turned off' style="width: 230px;padding:2px;">
                                                    <select onchange="onchangeturnofffrontend(this);" name="data[turn_front_end_on_off]" id="turn_front_end_on_off" class='cho'>
                                                            <option<?php if($view->settings['turn_front_end_on_off'] == 1){?> selected="selected"<?php }?> value="1">On</option>
                                                            <option<?php if($view->settings['turn_front_end_on_off'] == 0){?> selected="selected"<?php }?> value="0">Off</option>
                                                        </select>
                                                    </div>
                                                </div>
                                        </div>

                                        <div class="control-group" id="controlturn_off_img_url" <?php if($view->settings['turn_front_end_on_off'] == 1){?> style="display:none;"<?php } ?>>
                                                <label for="turn_off_img_url" class="control-label">Image to show</label>
                                                <div class="controls">
                                                        <div class="uploader tip" data-placement="right" id="uniform-file2" data-original-title="Image to show when the front-end is turned off">
                                                            <input type="file" class="uniform" id="turn_off_img_url" name="turn_off_img_url" size="19" style="opacity: 0;">
                                                            <span class="filename" style="-moz-user-select: none;">No file selected</span>
                                                            <span class="action" style="-moz-user-select: none;">Choose File</span>
                                                        </div>
                                                        <?php
                                                        $imgurl = $view->settings['turn_off_img_url'];
                                                        if($imgurl){
                                                        if(substr($imgurl, 0, 4) != "http"){
                                                            $imgurl = "../" . $imgurl;
                                                        }
                                                        ?>
                                                        <div class="deletepicturecls">
                                                        <a href="javascript:systemapp.deletePictureFile('setting','turn_off_img_url');">Delete image</a>
                                                        </div>
                                                        <div style="margin-top: 10px;">
                                                            <img src="<?php echo $imgurl;?>" />
                                                        </div>
                                                        <?php } ?>
                                                </div>

                                        </div>


                                        <div class="control-group">
                                                <label for="google_analytics_code" class="control-label">Google Analytics ID</label>
                                                <div class="controls">
                                                        <input class="mask_googleanalyticsid" type="text" placeholder="" name="data[google_analytics_code]" id="google_analytics_code" value="<?php echo @$view->settings['google_analytics_code'];?>">
                                                </div>
                                        </div>

                                        <div class="control-group">
                                                <label for="is_newsletter" class="control-label">Show newsletter checkbox</label>
                                                <div class="controls">
                                                        <select name="data[is_newsletter]" id="is_newsletter" class='cho'>
                                                            <option<?php if($view->settings['is_newsletter'] == 1){?> selected="selected"<?php }?> value="1">Yes</option>
                                                            <option<?php if(!$view->settings['is_newsletter']){?> selected="selected"<?php }?> value="0">No</option>
                                                        </select>
                                                </div>
                                        </div>

                                        <div class="control-group">
                                                <label for="is_name_and_email" class="control-label">Show Name and Email</label>
                                                <div class="controls">
                                                        <select name="data[is_name_and_email]" id="is_name_and_email" class='cho'>
                                                            <option<?php if($view->settings['is_name_and_email'] === "1"){?> selected="selected"<?php }?> value="1">Yes</option>
                                                            <option<?php if($view->settings['is_name_and_email'] === "0"){?> selected="selected"<?php }?> value="0">No</option>
                                                        </select>
                                                </div>
                                        </div>

                                        <div class="control-group">
                                                <label for="number_of_days" class="control-label">Number of days</label>
                                                <div class="controls">
                                                        <select name="data[number_of_days]" id="number_of_days" class='cho'>
                                                            <option<?php if($view->settings['number_of_days'] == "5"){?> selected="selected"<?php }?> value="5">5</option>
                                                           <option<?php if($view->settings['number_of_days'] == "7"){?> selected="selected"<?php }?> value="7">7</option>
                                                            <option<?php if($view->settings['number_of_days'] == "10"){?> selected="selected"<?php }?> value="10">10</option>
                                                        </select>
                                                </div>
                                        </div>

                                        <div class="control-group">
                                                <label for="date_check" class="control-label">Date check</label>
                                                <div class="controls">
                                                        <select name="data[date_check]" id="date_check" class='cho'>
                                                           <option<?php if($view->settings['date_check'] == "on"){?> selected="selected"<?php }?> value="on">On</option>
                                                            <option<?php if($view->settings['date_check'] == "off"){?> selected="selected"<?php }?> value="off">Off</option>
                                                        </select>
                                                </div>
                                        </div>
                                        
                                        <div class="control-group">
                                                <label for="is_show_custom_text_area" class="control-label">Show custom text area</label>
                                                <div class="controls">
                                                        <select name="data[is_show_custom_text_area]" id="is_show_custom_text_area" class='cho'>
                                                            <option<?php if($view->settings['is_show_custom_text_area'] == 1){?> selected="selected"<?php }?> value="1">Yes</option>
                                                            <option<?php if($view->settings['is_show_custom_text_area'] == 0){?> selected="selected"<?php }?> value="0">No</option>
                                                        </select>
                                                </div>
                                        </div>
                                        

                                        <div class="form-actions">
                                                <button class="btn btn-primary" type="submit">Save</button>
                                        </div>
                                    </div>

                                    <div class="tab-pane" id="2">
                                        <div class="control-group">
                                                <label for="is_show_logo" class="control-label">Show logo</label>
                                                <div class="controls">
                                                    <div class="tip" data-placement="right" data-original-title='Select if your logo should be shown in front-end or not' style="width: 230px;padding:2px;">
                                                        <select name="data[is_show_logo]" id="is_show_logo" class='cho' onchange="onchangeshowlogo(this);">
                                                                <option<?php if($view->settings['is_show_logo'] == 1){?> selected="selected"<?php }?> value="1">Yes</option>
                                                                <option<?php if($view->settings['is_show_logo'] == 0){?> selected="selected"<?php }?> value="0">No</option>
                                                        </select>
                                                    </div>
                                                </div>
                                        </div>

                                        <div class="control-group is_show_logo_yes">
                                                <label for="logo_url" class="control-label">Logo URL</label>
                                                <div class="controls">
                                                        <input class="tip" data-placement="right" data-original-title="Link the visitor is send to when clicking on your logo" style="width: 400px;" type="text" placeholder="Logo URL..." name="data[logo_url]" id="logo_url" value="<?php echo @$view->settings['logo_url'];?>">
                                                </div>
                                        </div>

                                        <div class="control-group is_show_logo_yes">
                                                <label for="logo_img_url" class="control-label">Logo Image</label>
                                                <div class="controls">
                                                    <div class="uploader tip" data-placement="right" id="uniform-file2" data-original-title="The image to show to users that do not like your Facebook page">
                                                        <input type="file" class="uniform" id="logo_img_url" name="logo_img_url" size="19" style="opacity: 0;">
                                                        <span class="filename" style="-moz-user-select: none;">No file selected</span>
                                                        <span class="action" style="-moz-user-select: none;">Choose File</span>
                                                    </div>
                                                    <?php
                                                    $imgurl = $view->settings['logo_img_url'];
                                                    if($imgurl){
                                                    if(substr($imgurl, 0, 4) != "http"){
                                                        $imgurl = "../" . $imgurl;
                                                    }
                                                    ?>
                                                    <div class="deletepicturecls">
                                                        <a href="javascript:systemapp.deletePictureFile('setting','logo_img_url');">Delete image</a>
                                                    </div>
                                                    <div style="margin-top: 10px;">
                                                        <img src="<?php echo $imgurl;?>" />
                                                    </div>
                                                    <?php } ?>
                                                </div>
                                        </div>

                                        <div class="control-group is_show_logo_yes">
                                                <label for="logo_custom_width" class="control-label">Logo custom width</label>
                                                <div class="controls">
                                                        <input class="tip" data-placement="right" data-original-title="Custom width for the logo image" type="text" name="data[logo_custom_width]" id="logo_custom_width" value="<?php echo @$view->settings['logo_custom_width'];?>">
                                                </div>
                                        </div>

                                        <div class="control-group is_show_logo_yes">
                                                <label for="logo_custom_height" class="control-label">Logo custom height</label>
                                                <div class="controls">
                                                        <input class="tip" data-placement="right" data-original-title="The height of logo. Leave it blank to get it update base on the width" type="text" name="data[logo_custom_height]" id="logo_custom_height" value="<?php echo @$view->settings['logo_custom_height'];?>">
                                                </div>
                                        </div>
                                        <div class="form-actions">
                                                <button class="btn btn-primary" type="submit">Save</button>
                                        </div>
                                    </div>

                                    <div class="tab-pane" id="3">
                                        <div class="control-group">
                                                <label for="is_use_default_like_gate" class="control-label">Like gate image</label>
                                                <div class="controls">
                                                        <select name="data[is_use_default_like_gate]" id="is_use_default_like_gate" class='cho' onchange="onchangelikegateoption();">
                                                            <option<?php if($view->settings['is_use_default_like_gate'] == 1){?> selected="selected"<?php }?> value="1">System default</option>
                                                            <option<?php if($view->settings['is_use_default_like_gate'] == 0){?> selected="selected"<?php }?> value="0">Custom image</option>
                                                        </select>
                                                    <?php
                                                    $imgurl = $view->settings['like_gate_img_url_default'];
                                                    if($imgurl){
                                                    if(substr($imgurl, 0, 4) != "http"){
                                                        $imgurl = "../" . $imgurl;
                                                    }
                                                    ?>
                                                    <div style="margin-top: 10px;<?php if($view->settings['is_use_default_like_gate'] == 0){?>display:none;<?php } ?>" id="idlike_gate_img_url_default">
                                                        <img style="width: 200px;" src="<?php echo $imgurl;?>" />
                                                    </div>
                                                    <?php } ?>
                                                </div>
                                        </div>

                                        <div class="control-group" id="controllike_gate_img_url"<?php if($view->settings['is_use_default_like_gate'] == 1){?> style="display:none;"<?php } ?>>
                                                <label for="like_gate_img_url" class="control-label">Custom like gate image</label>
                                                <div class="controls">
                                                    <div class="uploader" id="uniform-file2">
                                                        <input type="file" class="uniform" id="like_gate_img_url" name="like_gate_img_url" size="19" style="opacity: 0;">
                                                        <span class="filename" style="-moz-user-select: none;">No file selected</span>
                                                        <span class="action" style="-moz-user-select: none;">Choose File</span>
                                                    </div>
                                                    <?php
                                                    $imgurl = $view->settings['like_gate_img_url'];
                                                    if($imgurl){
                                                    if(substr($imgurl, 0, 4) != "http"){
                                                        $imgurl = "../" . $imgurl;
                                                    }
                                                    ?>
                                                    <div class="deletepicturecls">
                                                        <a href="javascript:systemapp.deletePictureFile('setting','like_gate_img_url');">Delete image</a>
                                                    </div>
                                                    <div style="margin-top: 10px;">
                                                        <img style="width: 200px;" src="<?php echo $imgurl;?>" />
                                                    </div>
                                                    <?php } ?>
                                                </div>
                                        </div>
                                        <div class="form-actions">
                                                <button class="btn btn-primary" type="submit">Save</button>
                                        </div>
                                    </div>

                                    <div class="tab-pane" id="4">
                                        <div class="control-group">
                                                <label for="terms_of_service" class="control-label">Terms of service</label>
                                                <div class="controls">
                                                        <div class="box box-content box-nomargin">
                                                                <textarea name="data[terms_of_service]" class='span12 cleditor'><?php echo @$view->settings['terms_of_service'];?></textarea>
                                                        </div>
                                                </div>
                                        </div>
                                        <div class="form-actions">
                                                <button class="btn btn-primary" type="submit">Save</button>
                                        </div>
                                    </div>

                                    <div class="tab-pane" id="5">

                                        <div class="control-group">
                                                <label for="is_show_facebook_share" class="control-label">Show Facebook Share Button</label>
                                                <div class="controls">
                                                    <div style="width: 230px;padding:2px;">
                                                        <select name="data[is_show_facebook_share]" id="is_show_facebook_share" class='cho' onchange="onchangeshowsharebutton(this);">
                                                                <option<?php if($view->settings['is_show_facebook_share'] == 1){?> selected="selected"<?php }?> value="1">Yes</option>
                                                                <option<?php if($view->settings['is_show_facebook_share'] == 0){?> selected="selected"<?php }?> value="0">No</option>
                                                        </select>
                                                    </div>
                                                </div>
                                        </div>

                                        <div class="control-group is_show_facebook_share_yes">
                                                <label for="facebook_share_title" class="control-label">Share title</label>
                                                <div class="controls">
                                                        <input type="text" name="data[facebook_share_title]" id="facebook_share_title" value="<?php echo @$view->settings['facebook_share_title'];?>">
                                                </div>
                                        </div>

                                        <div class="control-group is_show_facebook_share_yes">
                                                <label for="facebook_share_text" class="control-label">Share text</label>
                                                <div class="controls">
                                                        <input style="width: 400px;" type="text" name="data[facebook_share_text]" id="facebook_share_text" value="<?php echo @$view->settings['facebook_share_text'];?>">
                                                </div>
                                        </div>

                                        <div class="control-group is_show_facebook_share_yes">
                                                <label for="facebook_share_action_text" class="control-label">Share action text</label>
                                                <div class="controls">
                                                        <input type="text" name="data[facebook_share_action_text]" id="facebook_share_action_text" value="<?php echo @$view->settings['facebook_share_action_text'];?>">
                                                </div>
                                        </div>

                                        <div class="control-group is_show_facebook_share_yes">
                                                <label for="facebook_share_image_url" class="control-label">Share image</label>
                                                <div class="controls">
                                                    <div class="uploader" id="uniform-file2">
                                                        <input type="file" class="uniform" id="facebook_share_image_url" name="facebook_share_image_url" size="19" style="opacity: 0;">
                                                        <span class="filename" style="-moz-user-select: none;">No file selected</span>
                                                        <span class="action" style="-moz-user-select: none;">Choose File</span>
                                                    </div>
                                                    <?php
                                                    $imgurl = $view->settings['facebook_share_image_url'];
                                                    if($imgurl){
                                                    if(substr($imgurl, 0, 4) != "http"){
                                                        $imgurl = "../" . $imgurl;
                                                    }
                                                    ?>
                                                    <div class="deletepicturecls">
                                                        <a href="javascript:systemapp.deletePictureFile('setting','facebook_share_image_url');">Delete image</a>
                                                    </div>

                                                    <div style="margin-top: 10px;">
                                                        <img style="width: 200px;" src="<?php echo $imgurl;?>" />
                                                    </div>
                                                    <?php } ?>
                                                </div>
                                        </div>

                                        <div class="control-group is_show_facebook_share_yes">
                                                <label for="radio2" class="control-label">Select share button</label>
                                                <div class="controls">
                                                    <label class="radio"><input type="radio" name="data[facebook_share_button_url]" class='uniform' <?php if( $view->settings['facebook_share_button_url'] == "//slopetrackerlikewinn.s3.amazonaws.com/templates/default/layouts/images/facebook_button_no.png"){ ?> checked="checked" <?php } ?> id="radio2" value="//slopetrackerlikewinn.s3.amazonaws.com/templates/default/layouts/images/facebook_button_no.png"> <img src="//slopetrackerlikewinn.s3.amazonaws.com/templates/default/layouts/images/facebook_button_no.png" /></label>
                                                    <label class="radio"><input type="radio" class='uniform'  <?php if( $view->settings['facebook_share_button_url'] == "//slopetrackerlikewinn.s3.amazonaws.com/templates/default/layouts/images/facebook_button_en.png"){ ?> checked="checked" <?php } ?>  name="data[facebook_share_button_url]" value="//slopetrackerlikewinn.s3.amazonaws.com/templates/default/layouts/images/facebook_button_en.png"> <img src="//slopetrackerlikewinn.s3.amazonaws.com/templates/default/layouts/images/facebook_button_en.png" /></label>
                                                    <label class="radio"><input type="radio" class='uniform'  <?php if( $view->settings['facebook_share_button_url'] == "//slopetrackerlikewinn.s3.amazonaws.com/templates/default/layouts/images/facebook_button_en.png"){ ?> checked="checked" <?php } ?>  name="data[facebook_share_button_url]" value="//slopetrackerlikewinn.s3.amazonaws.com/templates/default/layouts/images/facebook_button_en.png"> <img src="//slopetrackerlikewinn.s3.amazonaws.com/templates/default/layouts/images/facebook_button_se.png" /></label>
                                                </div>
                                        </div>

                                        <div class="control-group">
                                            <label for="is_show_facebook_like" class="control-label">Show Facebook Like Button</label>
                                            <div class="controls">
                                                <div style="width: 230px;padding:2px;">
                                                    <select name="data[is_show_facebook_like]" id="is_show_facebook_like" class='cho' onchange="onchangeshowlikebutton(this);">
                                                            <option<?php if($view->settings['is_show_facebook_like'] == 1){?> selected="selected"<?php }?> value="1">Yes</option>
                                                            <option<?php if($view->settings['is_show_facebook_like'] == 0){?> selected="selected"<?php }?> value="0">No</option>
                                                    </select>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="control-group is_show_facebook_like_yes">
                                                <label for="facebook_like_title" class="control-label">Like title</label>
                                                <div class="controls">
                                                        <input type="text" name="data[facebook_like_title]" id="facebook_like_title" value="<?php echo @$view->settings['facebook_like_title'];?>">
                                                </div>
                                        </div>

                                        <div class="control-group is_show_facebook_like_yes">
                                                <label for="facebook_like_text" class="control-label">Like text</label>
                                                <div class="controls">
                                                        <input style="width: 400px;" type="text" name="data[facebook_like_text]" id="facebook_like_text" value="<?php echo @$view->settings['facebook_like_text'];?>">
                                                </div>
                                        </div>

                                        <div class="control-group is_show_facebook_like_yes">
                                                <label for="facebook_like_image_url" class="control-label">Like Image</label>
                                                <div class="controls">
                                                    <div class="uploader" id="uniform-file2">
                                                        <input type="file" class="uniform" id="facebook_like_image_url" name="facebook_like_image_url" size="19" style="opacity: 0;">
                                                        <span class="filename" style="-moz-user-select: none;">No file selected</span>
                                                        <span class="action" style="-moz-user-select: none;">Choose File</span>
                                                    </div>
                                                    <?php
                                                    $imgurl = $view->settings['facebook_like_image_url'];
                                                    if($imgurl){
                                                    if(substr($imgurl, 0, 4) != "http"){
                                                        $imgurl = "../" . $imgurl;
                                                    }
                                                    ?>
                                                    <div class="deletepicturecls">
                                                        <a href="javascript:systemapp.deletePictureFile('setting','facebook_like_image_url');">Delete image</a>
                                                    </div>
                                                    <div style="margin-top: 10px;">
                                                        <img style="width: 200px;" src="<?php echo $imgurl;?>" />
                                                    </div>
                                                    <?php } ?>
                                                </div>
                                        </div>

                                        <div class="form-actions">
                                                <button class="btn btn-primary" type="submit">Save</button>
                                        </div>
                                    </div>

                                </div>
                        </div>
                        </fieldset>
                    </form>

		</div>
	</div>
</div>
<script type="text/javascript">
    function onchangelikegateoption(){
        var s = document.getElementById("is_use_default_like_gate");
        if(s.value == 1){
            $("#controllike_gate_img_url").css("display", "none");
            $("#idlike_gate_img_url_default").fadeIn();
        } else {
            $("#idlike_gate_img_url_default").css("display", "none");
            $("#controllike_gate_img_url").fadeIn();
        }
    }
    function onchangeturnofffrontend(s){
        if(s.value == 1){
            $("#controlturn_off_img_url").fadeOut();
        } else {

            $("#controlturn_off_img_url").fadeIn();
        }
    }

    function onchangeshowlogo(s){
        if(s.value == 1){
            $(".is_show_logo_yes").fadeIn();
        } else {
            $(".is_show_logo_yes").fadeOut();
        }
    }

    function onchangeshowsharebutton(s){
        if(s.value == 1){
            $(".is_show_facebook_share_yes").fadeIn();
        } else {
            $(".is_show_facebook_share_yes").fadeOut();
        }
    }

    function onchangeshowlikebutton(s){
        if(s.value == 1){
            $(".is_show_facebook_like_yes").fadeIn();
        } else {
            $(".is_show_facebook_like_yes").fadeOut();
        }
    }

</script>